package com.designpattern.behave.authlink;

import lombok.extern.slf4j.Slf4j;

/**
 * @author chengze
 * @date 2022/12/2
 * @desc 节点一
 */
@Slf4j
public class AuthNode1 extends AuthLink{

    public AuthNode1(String nodeName) {
        super(nodeName);
    }

    @Override
    public boolean doAuth() {
        log.info("节点 {} 执行",super.getNodeName());
        if (FinalNodeName.finalNodeName.equals(super.getNodeName())){
            log.info("任务被节点 {} 处理",super.getNodeName());
            return true;
        }
        AuthLink nextNode = super.getNextNode();
        if (nextNode == null){
            log.error("任务未处理");
            return false;
        }
        log.info("节点 {} 未处理",super.getNodeName());
        return nextNode.doAuth();
    }
}
